<!--
 * @Description: 
 * @Author: xiongkuobiao
 * @Date: 2023-02-21 21:41:26
 * @LastEditors: xiongkuobiao
 * @LastEditTime: 2023-02-23 10:31:24
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    let str = "1111234.22";
    let arr = str.split(".")[0].split("").reverse();
    let newArr = [];
    for (let i = 0; i < arr.length; i++) {
      if (i && i % 3 == 0) {
        newArr.unshift(`${arr[i]},`);
      } else {
        newArr.unshift(arr[i]);
      }
    }
    console.log(str.split(".")[1]);
    console.log(newArr.join(""));

    console.log(newArr);
  </script>
</html>
